Skip to content

Chinese arguments are corrupted by native image on Windows#13359

Open
JaroslavTulach wants to merge 2 commits intooracle:masterfrom
JaroslavTulach:jtulach/ChineseArguments
Open

Chinese arguments are corrupted by native image on Windows#13359
JaroslavTulach wants to merge 2 commits intooracle:masterfrom
JaroslavTulach:jtulach/ChineseArguments

Conversation

@JaroslavTulach
Copy link
Copy Markdown
Contributor

@JaroslavTulach JaroslavTulach commented Apr 18, 2026

Summary

Related Issues

  • there already is a Maven project that shows the fialure
  • this PR just tries to find some project in GraalVM sources that could be modified to show the problem as well

Testing

  • I run my code as
graal/substratevm$ mx --java-home ~/bin/labsjdk-ce-25.0.2-jvmci-b01/ hellomodule
  • and it works on Linux. I assume (and will verify) that it fails on Windows

Documentation

  • No documentation needs to be updated

Contributor Checklist

  • I have read the contribution guide.
  • I have the right to contribute the submitted material under the project terms.
  • I have updated tests and documentation where appropriate.
  • I don't use coding assistants

@oracle-contributor-agreement oracle-contributor-agreement Bot added the OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. label Apr 18, 2026
@JaroslavTulach JaroslavTulach changed the base branch from master to release/graal-vm/25.0 April 18, 2026 06:32
@oracle-contributor-agreement
Copy link
Copy Markdown

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement Bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Apr 18, 2026
List<String> lines = proc.inputReader().lines().toList();
assert lines.size() == 1 : "Assuming one line " + lines;
// System.err.println("got: " + lines.get(0));
assert lines.get(0).equals("[" + t1 + ", " + t2 + ", " + t3 + "]");
Copy link
Copy Markdown
Contributor Author

@JaroslavTulach JaroslavTulach Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running on my (VirtualBox) Windows I get:

PS C:\graal\substratevm> mx --java-home \labsjdk-ce-25.0.2-jvmci-b01\ hellomodule
...
Exception in thread "main" java.lang.AssertionError
        at moduletests.hello.app/hello.Main.testPassingArguments(Main.java:183)
        at moduletests.hello.app/hello.Main.main(Main.java:71)
        at java.base@25.0.2/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
Command 'C:\\graal\\substratevm\\svmbuild\\hellomodule\moduletests.hello.app' returned non-zero exit status 1.

E.g. looks like we have a reproducer! Also running just the app itself shows the same problem:

graal\substratevm> .\svmbuild\hellomodule\moduletests.hello.app.exe print 使 用 者
[]

e.g. these non-ASCII arguments aren't even passed to the app

Copy link
Copy Markdown
Contributor Author

@JaroslavTulach JaroslavTulach Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A sample fix is provided in 143d664, but I understand it is not properly placed. The code seems to deal with isolates & co. and I need some guidance to make sure these GetCommandLineW arguments are only read when appropriate. CCing @wirthi

However with the 143d664 fix we certainly propagate the chines arguments to the above program:

PS graal\substratevm> [Console]::OutputEncoding = [System.Text.Encoding]::Unicode;
PS graal\substratevm> .\svmbuild\hellomodule\moduletests.hello.app.exe print 使用 者
[使用, 者]

e.g. the fix isn't "completely off".

@oubidar-Abderrahim
Copy link
Copy Markdown
Member

Thanks for the contribution and for working on this fix. I noticed this PR targets the release/graal-vm/25.0 branch, is there any particular reason to not merge into master?

@JaroslavTulach JaroslavTulach force-pushed the jtulach/ChineseArguments branch from 143d664 to bfab13a Compare April 24, 2026 12:48
@oracle-contributor-agreement oracle-contributor-agreement Bot added OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. and removed OCA Verified All contributors have signed the Oracle Contributor Agreement. labels Apr 24, 2026
@JaroslavTulach JaroslavTulach changed the base branch from release/graal-vm/25.0 to master April 24, 2026 12:49
@oracle-contributor-agreement
Copy link
Copy Markdown

Thank you for signing the OCA.

@oracle-contributor-agreement oracle-contributor-agreement Bot added OCA Verified All contributors have signed the Oracle Contributor Agreement. and removed OCA Required At least one contributor does not have an approved Oracle Contributor Agreement. labels Apr 24, 2026
@JaroslavTulach
Copy link
Copy Markdown
Contributor Author

Thanks for the contribution and for working on this fix. I noticed this PR targets the release/graal-vm/25.0 branch, is there any particular reason to not merge into master?

  • there is no particular reason except that Enso is using GraalVM 25.0.2
  • rebased to master
  • thanks for your review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

native-image OCA Verified All contributors have signed the Oracle Contributor Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants